//
//  LBEmptyBuyCarView.m
//  loveBeen
//
//  Created by 郭小双 on 16/11/20.
//  Copyright © 2016年 loveBeen. All rights reserved.
//

#import "LBEmptyBuyCarView.h"

@implementation LBEmptyBuyCarView
- (instancetype)initWithFrame:(CGRect)frame{
    if(self = [super initWithFrame:frame]){
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    
    self.backgroundColor = [UIColor colorWithRed:239.0/255 green:239.0/255 blue:239.0/255 alpha:1];
    
    UIView *circleView = [[UIView alloc]init];
    [self addSubview:circleView];
    circleView.layer.cornerRadius = 40;
    circleView.layer.masksToBounds = YES;
    circleView.backgroundColor = [UIColor colorWithRed:254.0/255 green:212.0/255 blue:48.0/255 alpha:1];
    
    UIImageView *shopCartView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"v2_shopCart"]];
    [circleView addSubview:shopCartView];
    
    [shopCartView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.center.equalTo(circleView);
        make.width.height.mas_equalTo(40);
    }];
    
    UILabel *suggestLab = [UILabel cz_labelWithText:@"亲，购物车空空如的耶～赶紧挑好吃的吧" fontSize:14 color:[UIColor blackColor]];
    [self addSubview:suggestLab];
    
    UIButton *shopBtn = [UIButton cz_textButton:@"去逛逛" fontSize:15 normalColor:[UIColor grayColor] selectedColor:[UIColor blueColor]];
    shopBtn.layer.borderColor = [UIColor grayColor].CGColor;
    shopBtn.layer.borderWidth = 2.0;
    shopBtn.layer.cornerRadius = 10.0;
    shopBtn.layer.masksToBounds = YES;
    [shopBtn addTarget:self action:@selector(clickShopBtn:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:shopBtn];
    
    
    UIView *bottomView = [[UIView alloc]init];
    bottomView.backgroundColor = [UIColor whiteColor];
    [self addSubview:bottomView];
//    UILabel *priceLab = [UILabel cz_labelWithText:@"共$0元" fontSize:13 color:[UIColor redColor]];
//    [bottomView addSubview:priceLab];
//    
//    UIButton *finishBtn = [UIButton cz_textButton:@"选好了" fontSize:13 normalColor:[UIColor blackColor] selectedColor:[UIColor blueColor]];
//    finishBtn.backgroundColor = [UIColor colorWithRed:254.0/255 green:212.0/255 blue:48.0/255 alpha:1];
//    [bottomView addSubview:finishBtn];
//    
    
    [circleView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(self).offset(150);
        make.width.height.mas_equalTo(80);
    }];
    
    [suggestLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(circleView.mas_bottom).offset(40);
    }];
    
    [shopBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.width.mas_equalTo(120);
        make.height.mas_equalTo(25);
        make.top.equalTo(suggestLab.mas_bottom).offset(40);
    }];
    
    [bottomView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.bottom.equalTo(self);
        make.height.mas_equalTo(45);
    }];
    
//    [priceLab mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.left.equalTo(bottomView).mas_equalTo(10);
//        make.centerY.equalTo(bottomView);
//        
//    }];
//    
//    [finishBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.top.right.bottom.equalTo(bottomView);
//        make.width.mas_equalTo(60);
//    }];
    
}
- (void)clickShopBtn:(UIButton *)sender{
    if([self.delegate respondsToSelector:@selector(LBEmptyBuyCarView:)]){
        [self.delegate LBEmptyBuyCarView:self];
    }
}


@end
